import 'package:flutter/material.dart';
import 'package:wan_android_flutter/common_code/configs/app_config.dart';

import '../../short_video/models/short_video_list_model.dart';

class ProjectPageCell extends StatefulWidget {
  const ProjectPageCell({super.key, required this.itemModel});

  final ShortVideoListItemModel itemModel;

  @override
  State<ProjectPageCell> createState() => _ProjectPageCellState();
}

class _ProjectPageCellState extends State<ProjectPageCell> {
  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: BorderRadius.circular(6),
      child: Container(
        color: Colors.white,
        child: Column(
          children: [
            FadeInImage.assetNetwork(
              placeholder: AppConfig.placeholder,
              image: widget.itemModel.poster_small ?? '',
              fit: BoxFit.cover,
              placeholderFit: BoxFit.contain,
            ),
            Padding(
              padding: EdgeInsets.all(6),
              child: Text(
                widget.itemModel.title ?? '',
                style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),
              ),
            ),
            Row(
              children: [
                Padding(
                  padding: EdgeInsets.symmetric(horizontal: 6, vertical: 6),
                  child: ClipOval(
                    child: FadeInImage.assetNetwork(
                      placeholder: AppConfig.placeholder,
                      image: widget.itemModel.author_avatar ?? '',
                      width: 30,
                      height: 30,
                    ),
                  ),
                ),
                Text(widget.itemModel.source_name ?? ''),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
